package com.itheima.com.排序;

import java.util.Arrays;

public class BubbleSort {

    public static void main(String[] args) {
        int[] a = {61, 33, 17, 11, 19, 22, 43, 23, 44};
        sort(a);
    }

    private static void sort(int[] a) {
        int temp;
        for (int j = 0; j < a.length - 1; j++) {
            for (int i = 0; i < a.length - 1 - j; i++) {
                if (a[i] > a[i + 1]) {
                    temp = a[i + 1];
                    a[i + 1] = a[i];
                    a[i] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(a));
    }
}
